﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace Air_condition.DO
{
    [Serializable]
    class Equip
    {
        string sname;

        public string sName
        {
            get { return sname; }
            set { sname = value; }
        }
        int itype;

        public int iType
        {
            get { return itype; }
            set { itype = value; }
        }
        double dbenergy;

        public double dbEnergy
        {
            get { return dbenergy; }
            set { dbenergy = value; }
        }

        public object Clone()
        {
            object clone;
            try
            {
                using (MemoryStream stream = new MemoryStream())
                {

                    BinaryFormatter formatter = new BinaryFormatter();

                    // Serialize this object

                    formatter.Serialize(stream, this);

                    stream.Position = 0;

                    // Deserialize to another object

                    clone = formatter.Deserialize(stream);

                }
                return clone;
            }
            catch (Exception e)
            {
                return e;
            }

        }
    }
}
